{% extends 'system_template/public/base_main.html' %}
{% block cite %}
    用户管理
{% endblock %}
{% block head %}
<style>
.layui-form-select .layui-input{
    padding-right: 0!important;
}
form div{float: left;}
form{position: relative}
</style>
{% endblock %}
{% block content %}
    <div class="layui-card-header">
        <button class="layui-btn layui-btn-danger" onclick="checkbox(this,'DELETES')">
            <i class="layui-icon"></i>批量删除
        </button>
        <button class="layui-btn layui-btn-normal" onclick="tl_cms.open('添加用户','{{ url_for('sys_bp.user_add') }}',700,600,true)">
            <i class="layui-icon"></i>添加
        </button>
        <button class="layui-btn layui-btn-warm layui-btn-radius" title="允许使用" datatype="onfree" onclick="btn_status(this)">启用 </button>
        <button class="layui-btn layui-btn-warm layui-btn-radius" title="允许留言" datatype="oncomment" onclick="btn_status(this)">留言 </button>
        <button class="layui-btn layui-btn-warm layui-btn-radius" title="允许发布文章" datatype="oncontent" onclick="btn_status(this)">文章</button>
        <button class="layui-btn layui-btn-danger layui-btn-radius" title="禁止使用" datatype="unfree" onclick="btn_status(this)">停用 </button>
        <button class="layui-btn layui-btn-danger layui-btn-radius" title="禁止留言" datatype="uncomment" onclick="btn_status(this)">留言 </button>
        <button class="layui-btn layui-btn-danger layui-btn-radius" title="禁止发布文章" datatype="uncontent" onclick="btn_status(this)">文章</button>
        <form class="layui-form search" style="float: right">
            <div style="width: 70px;position: relative;top:3px">
            <select name="search_model"><option value="1">登录名</option><option value="2">QQ号</option></select>
            <div class="layui-unselect layui-form-select">
                <div class="layui-select-title">
                    <input type="text" class="layui-input layui-unselect">
                    <i class="layui-edge"></i></div>
            </div>
          </div>
            <div class="layui-inline layui-show-xs-block" style="position: relative;top:3px">
                <input type="text" name="search" placeholder="输入文档标题查询..." class="layui-input" value="{{ request.args.get('search','') }}">
            </div>
            <div class="layui-inline layui-show-xs-block" style="position: relative;top: -1px;">
                <button class="layui-btn layui-btn-normal"><i class="layui-icon"></i>查询</button>
            </div>
        </form>
    </div>
   <table class="layui-table layui-form">
    <thead>
    <tr>
        <th>
            <input type="checkbox" lay-skin="primary" lay-filter="c_all">
            <div class="layui-unselect layui-form-checkbox" lay-skin="primary"><i class="layui-icon layui-icon-ok"></i></div>
        </th>
        <th>用户ID</th>
        <th>登录名称</th>
        <th>用户昵称</th>
        <th>登录次数</th>
        <th>用户积分</th>
        <th>注册时间</th>
        <th>最近登录</th>
        <th>用户状态</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    {% for data in data_list %}
     <tr>
        <td>
            <input type="checkbox"  lay-skin="primary" value="{{ data.id }}">
            <div class="layui-unselect layui-form-checkbox" lay-skin="primary"><i class="layui-icon layui-icon-ok"></i></div>
        </td>
        <td>{{ data.uuid }}</td>
        <td>{{ data.username }}</td>
        <td>{{ data.user_nickname or '' }}</td>
        <td>{{ data.user_logins or 0 }}</td>
        <td>{{ data.user_integral or 0 }}</td>
        <td>{{ data.update_time.strftime('%Y-%m-%d %H:%M:%S') }}</td>
        <td>{{ data.new_login_time.strftime('%Y-%m-%d %H:%M:%S') }}</td>
        <td>{{ data.status|status }}</td>
        <td class="td-manage">
            <a class="but_sm" title="修改" onclick="tl_cms.open('编辑','{{ url_for('sys_bp.user_edit',uid=data.id) }}')" href="javascript:;">
                修改</a>
            <a class="but_sm del_but" title="删除" onclick="del(this,'{{ data.id }}')" href="javascript:;">删除</a>
        </td>
    </tr>
        {% endfor %}
        </tbody>
    </table>
    {% if page.pages>1 %}
    <div class="layui-card-body ">
        <div class="page">
            <div>
            <a {% if page.has_prev %}class="next" href="?page={{ page.prev_num }}" {% else %}class="layui-btn-disabled"{% endif %}>上一页</a>
                {% for pg in page.iter_pages(2,2,2,2) %}
                    {% if page.page==pg %}
                        <span class="current">{{ pg }}</span>
                    {% else %}
                        {% if pg %}
                        <a class="num" href="?page={{ pg }}">{{ pg }}</a>
                        {% endif %}
                    {% endif %}
                {% endfor %}
            {% if not page.pages==page.page %}
            <a class="num" href="?page={{ page.pages }}">最后一页</a>
                {% endif %}
                <a {% if page.has_next %}class="next" href="?page={{ page.next_num }}" {% else %}class="layui-btn-disabled"{% endif %}>下一页</a>
            </div>
        </div>
    </div>
    {% endif %}
{% endblock %}


